package com.culture.bootdemo.model.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

/**
 * 一个service多个实现类 枚举
 */
@Getter
@AllArgsConstructor
public enum MultipleServiceEnum {
    //
    first("1", "multipleService1Impl"),
    second("2", "multipleService2Impl");

    String status;
    String desc;



    public static MultipleServiceEnum getInstance(String status) {
        if (StringUtils.isBlank(status)) {
            return null;
        }
        for (MultipleServiceEnum approvalStatus : MultipleServiceEnum.values()) {
            if (approvalStatus.getStatus().equals(status)) {
                return approvalStatus;
            }
        }
        return null;
    }

    public static String getInstanceDesc(String status) {
        if (StringUtils.isBlank(status)) {
            return "";
        }
        for (MultipleServiceEnum approvalStatus : MultipleServiceEnum.values()) {
            if (approvalStatus.getStatus().equals(status)) {
                return approvalStatus.getDesc();
            }
        }
        return "";
    }
}
